all: boot.img

boot.o: boot.S inc.h
	gcc -nostdinc -I . -gstabs -O1 -fno-builtin -MD -Wall -m32 -c -o boot.o boot.S
	
boot: boot.o
	ld -LDFLAGS -N -e start -Ttext 0x7c00 -o boot.out boot.o
	objdump -S boot.o boot.out > boot_out.asm
	objcopy -S -O binary boot.out boot
	perl sign.pl boot
boot.img: boot
	dd if=/dev/zero of=boot.img~ count=10000 2>/dev/null
	dd if=boot of=boot.img~ conv=notrunc 2>/dev/null
	mv boot.img~ boot.img
clean:
	rm -f boot.o boot.out boot_out.asm boot boot.img~ boot.img
